
$('#invest').click(function(){
        var session         = $('#session').val();
        var status          = $('#status').val();
        var money           = $('#money').val();
        var user_balance    = $('#user_balance').val();
        if(!session){
            return false;
        }
        if(!status){
            Showbo.Msg.nameauth('请先完成实名认证，确保您账户安全',function(){
                window.location.href='/username_auth_one';
            })
            return false;
        }
        if(money== ''){
            Showbo.Msg.nameauth('请输入投资金额',function(){

            })
            return false;
        }else{

            if(isNaN(money)){
            Showbo.Msg.nameauth("金额必须是数字！！！",function(btn){
            })
            return false;
            }
            if(user_balance<money){
                Showbo.Msg.nameauth('余额不足，请充值',function(){
                    // window.location.href='/user_money';
                })
            }else{
                    var user_balance    = $('#user_balance').val();
                    var project_id      = $('#project_id').val();
                    var type            = $('#type').val();
                    $.ajax({
                    url : '/project_pay',
                    type : "POST",
                    data : {user_balance:user_balance,money:money,project_id:project_id,type:type},
                    dataType : "json",
                    cache:"false",
                    timeout:30000,
                     success: function (json) {
                                if (json.code == 1) {//ok
                                    window.location.href = json.url;
                                    return false;
                                } if (json.code == 2) {//ok
                                    alert(json.mess);
                                }
                            }

            });
            //location.href='/project_pay/?project_id=<?php echo $v->project_id?>&type=<?php echo $v->type?>&money='+money
            }
        }
    })
